<div id="order">
    <div class="search-order">
        <form>
            <fieldset>
                <legend>Tìm kiếm thông tin đơn hàng</legend>
                <div class="keyword">Tên khách hàng: <input type="text"/></div>
                <div class="state">
                    Trạng thái: <select>
                                    <option value="">Tất cả...</option>
                                    <option value="0">Chưa xác nhận</option>
                                    <option value="1">Đã xác nhận</option>
                                </select>
                
                </div>
                <div class="search"><input type="button" value="Tìm"/></div>
            </fieldset>
        </form>
    </div>
    <div class="show-all">
        <input type="button" value="Hiển thị tất cả"/>
    </div>
    
    <!-- show all orther here -->
    <div class="show-order">
    </div>
</div><!-- end order -->
<script>
$(function(){
	var link = "<?php echo $this->url(array('module'=>'admin', 'controller'=>'order','action'=>'list'))?>";
	$.ajax({
	    url: link,
	    success: function(data){
		    $("#order .show-order").html(data);
		    }
		});
});

//search information of order
$(function(){
	$("#order .search-order .search input").click(function(){
		var keyword = $(".search-order .keyword input").val(),
    	    state = $(".search-order .state select").val(),
    	    link = "<?php echo $this->url(array('module'=>'admin', 'controller'=>'order','action'=>'list'))?>",
    	    rdata = {"param": {"keyword": keyword, "state": state}};
// 	    alert(keyword);
	    $.ajax({
		    url: link,
		    data: rdata,
		    success: function(data){
		    	$("#order .show-order").html(data);
			    }
		    });
	    return false;
		});
});


$(function(){
    $("#order .show-all input").click(function(){
    	var link = "<?php echo $this->url(array('module'=>'admin', 'controller'=>'order','action'=>'list'))?>";
    	$.ajax({
    	    url: link,
    	    success: function(data){
    		    $("#order .show-order").html(data);
    		    }
    		});
        });
});
</script>